import uniqueId from '@form-create/utils/lib/unique';
import {localeProps, makeRequiredRule} from '../../utils';

const label = '评分';
const name = 'jd-rate';

export default {
    icon: 'icon-rate',
    label,
    name,
    rule({t}) {
        return {
            type: 'rate',
            field: 'PF',
            title: '评分',
            info: '',
            $required: false,
            validate: false,
            props: {},
        };
    },
    props(_, {t}) {
        return localeProps(t, name + '.props', [
            makeRequiredRule(), 
            {
                type: 'row',
                props: {gutter: 5},
                children: [
                    {
                        type: 'col',
                        props: {span: 12},
                        children: [
                            {type: 'switch', field: 'allowHalf', title: '允许半选'}
                        ]
                    },
                    {
                        type: 'col',
                        props: {span: 12},
                        children: [
                            {type: 'input', field: 'max', title: '最大分值'}
                            
                        ]
                    }
                ]
            },
            {
                type: 'row',
                props: {gutter: 5},
                children: [
                    {
                        type: 'col',
                        props: {span: 12},
                        children: [
                            {type: 'input', field: 'voidColor', title: '未选中图标颜色'}
                        ]
                    },
                    {
                        type: 'col',
                        props: {span: 12},
                        children: [
                            {type: 'input', field: 'disabledVoidColor', title: '只读时图标颜色'}
                        ]
                    }
                ]
            }
        ]);
    }
};